using System;
using System.Drawing;
using System.Windows.Forms;

namespace Welcome
{
	public delegate void StartDelegate();

	public class Eventdemo : Form
	{
		public event StartDelegate StartEvent;

		public Eventdemo()
		{
			Button clickMe = new Button();

			clickMe.Parent = this;
			clickMe.Text = "Click me";
			clickMe.Location = new Point(
				(ClientSize.Width - clickMe.Width) / 2,
				(ClientSize.Height - clickMe.Height) / 2);

			clickMe.Click += new EventHandler(OnClickMeClicked);

			StartEvent += new StartDelegate(OnStartEvent);

			StartEvent();			
		}

		public void OnClickMeClicked(object sender, EventArgs args)
		{
			MessageBox.Show("You clicked my button");
		}

		public void OnStartEvent()
		{
			MessageBox.Show("I just started!");
		}

		public static void Main()
		{
			Application.Run(new Eventdemo());
		}
	}
}
